package com.service.statistics.controller;


import com.service.statistics.client.UcenterMemberClient;
import com.service.statistics.pojo.Daily;
import com.service.statistics.pojo.vo.SearchObj;
import com.service.statistics.service.DailyService;
import com.service.utils.ResultVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-10-19
 */
@RestController
@RequestMapping("daily")
public class DailyController {

    @Autowired
    private DailyService dailyService;

    @ApiOperation("统计某一天的数据,并添加到数据库")
    @GetMapping("createStatisticsDaily/{day}")
    public ResultVo createStatisticsDaily(@PathVariable String day){
        dailyService.StatisticsDailyCount(day);
         return ResultVo.ok();
    }


    @ApiOperation("查询某一天的统计数据")
    @PostMapping("queryCount")
    public ResultVo queryCount(@RequestBody SearchObj searchObj){
       Map<String,Object> result =    dailyService.queryCount(searchObj);
        return ResultVo.ok().data(result);
    }


}

